import { message } from "ant-design-vue";
import axios from "axios";
const request = axios.create({
    baseURL: 'https://yfzx.dysmt.cn/api/dysmt-service/',
    timeout : 5000
}); 
export default request;
request.interceptors.request.use((c) => {
    const token = sessionStorage.getItem('token');
    if(token){
        c.headers = {
            ...c.headers,
            token,
        };
    }
    return c;
});
// 监听网络请求
request.interceptors.response.use(
    (res) => {
        return res.data;
    },
    (e) => {
        message.error (e.response.data.message);
        return Promise.reject(e.response.data.message);
    }
);